package com.thwcompany.thread;
/**
 * Created by IntelliJ IDEA2021.3
 * @Author: Tenghw
 * @Date: 2022/04/05  19:49
 * @Description:
 */
public class ThreadDemo1{

    public void main(String[] args) throws InterruptedException {
      Runnable runnable=()->{
          for (int i=0;i<5;i++){
              System.out.println("runnable执行线程---"+Thread.currentThread().getName()+"---i="+i);
          }
      };

        Thread thread1 = new Thread(runnable);
        thread1.start();
        for (int a=0;a<5;a++){
            System.out.println("执行线程"+Thread.currentThread().getName()+"---a="+a);
            if(a==2){
                Thread.sleep(1);
            }

        }





    }

}
